/*
* ANO_DT_User_Settings.h
*
*  Created on: 2016.11.25
*      Author: DGVY
*/

#ifndef __ANO_DT_USER_SETTINGS_H_
#define __ANO_DT_USER_SETTINGS_H_
#include "dataconvert.h"

/*************在此区域定义外部变量，然后在control.c定义变量实体***/
extern u16 kp_b, kd_b, ki_b;
extern u16 speed_MAX, speedL_MAX;
extern u16 ACC_Start, ACC_End;
extern u16 PID_Len;
extern u16 ACC_Refer;	//减速阶段参速度比例
//PID参数
extern PID_TypeDef  PID[5];

extern s16 GetBLenY, SendCBLenY, SendCBLenX1, SendCBLenX2, SendGBLenX, SendGBLenY, SendGBLenY1;
/**************************************************************/
void Posotion_SetANO(void);

// -----用到的UART口-----
// USART1 -- 1
// USART2 -- 2
// USART3 -- 3
// USART4 -- 4
#define ANO_DT_UART_PORT_SELECT 1

// 参数放大比例，单片机内的参数将乘以此数，再存入FLASH或发送到上位机
#define ANO_DT_PARAMETER_SCALING   1

// 单片机内部参数类型
#define ANO_DT_PARAMETER_TYPE (double)

// 单片机内部数据存储地址，默认为FLASH的第八扇区
#define ANO_DT_PID_DATA_SAVE_FLASH_ADDRESS ADDR_FLASH_SECTOR_9


// -----要调节的数据，以下数据与匿名地面站"飞控参数"一栏一一对应----

#define USE_PID_01 1
#define USE_PID_02 1
#define USE_PID_03 1
#define USE_PID_04 1
#define USE_PID_05 1
#define USE_PID_06 1
#define USE_PID_07 1
#define USE_PID_08 1
#define USE_PID_09 1
#define USE_PID_10 1
#define USE_PID_11 1
#define USE_PID_12 1
#define USE_PID_13 1
#define USE_PID_14 1
#define USE_PID_15 1
#define USE_PID_16 1
#define USE_PID_17 1
#define USE_PID_18 1


//在此区域儿去改变用户自己定义相应变量，与飞控相对应
#if defined(USE_PID_01)
#define PID_01_P    PID[PID_LineX].target
#define PID_01_I    PID[PID_LineY].target
#define PID_01_D    PID[PID_Angle].target
#endif

#if defined(USE_PID_02)
#define PID_02_P    ACC_Start
#define PID_02_I    ACC_End
#define PID_02_D    ACC_Refer
#endif

#if defined(USE_PID_03)
#define PID_03_P    speed_MAX
#define PID_03_I    speedL_MAX
#define PID_03_D    PID_Len
#endif

#if defined(USE_PID_04)
#define PID_04_P   	PID[PID_LineX].Kp
#define PID_04_I    PID[PID_LineX].Ki
#define PID_04_D    PID[PID_LineX].Kd
#endif

#if defined(USE_PID_05)
#define PID_05_P    PID[PID_LineY].Kp
#define PID_05_I    PID[PID_LineY].Ki
#define PID_05_D    PID[PID_LineY].Kd
#endif

#if defined(USE_PID_06)
#define PID_06_P    PID[PID_Angle].Kp
#define PID_06_I    PID[PID_Angle].Ki
#define PID_06_D    PID[PID_Angle].Kd
#endif

#if defined(USE_PID_07)
#define PID_07_P    PID[PID_CorrectX].Kp
#define PID_07_I    PID[PID_CorrectX].Ki
#define PID_07_D    PID[PID_CorrectX].Kd
#endif

#if defined(USE_PID_08)
#define PID_08_P    PID[PID_CorrectY].Kp
#define PID_08_I    PID[PID_CorrectY].Ki
#define PID_08_D    PID[PID_CorrectY].Kd
#endif
#if defined(USE_PID_09)
#define PID_09_P    GetBLenY
#define PID_09_I    SendCBLenY
#define PID_09_D    SendCBLenX1
#endif


#if defined(USE_PID_10)
#define PID_10_P    SendCBLenX2
#define PID_10_I    SendGBLenX
#define PID_10_D    SendGBLenY
#endif

#if defined(USE_PID_11)
#define PID_11_P    SendGBLenY1
#define PID_11_I    ki_b
#define PID_11_D    kd_b
#endif

#if defined(USE_PID_12)
#define PID_12_P    kp_b
#define PID_12_I    ki_b
#define PID_12_D    kd_b
#endif

#if defined(USE_PID_13)
#define PID_13_P    kp_b
#define PID_13_I    ki_b
#define PID_13_D    kd_b
#endif

#if defined(USE_PID_14)
#define PID_14_P    kp_b
#define PID_14_I    ki_b
#define PID_14_D    kd_b
#endif

#if defined(USE_PID_15)
#define PID_15_P    kp_b
#define PID_15_I    ki_b
#define PID_15_D    kd_b
#endif

#if defined(USE_PID_16)
#define PID_16_P    kp_b
#define PID_16_I    ki_b
#define PID_16_D    kd_b
#endif

#if defined(USE_PID_17)
#define PID_17_P    kp_b
#define PID_17_I    ki_b
#define PID_17_D    kd_b
#endif

#if defined(USE_PID_18)
#define PID_18_P    kp_b
#define PID_18_I    ki_b
#define PID_18_D    kd_b
#endif

#endif
/* ANO_DT_ANO_DT_USER_SETTINGS_H_ */
